﻿@model MVC.ViewModels.ShoppingCartListVm
@{
    ViewBag.HasSideBar = false;
}
<div>
    <h4><em>Review your cart</em></h4>
    <hr />
    @if (Model.Carts.Count > 0)
    {
        <table class="table">
            <tr class="info">
                <th>
                    Album Name
                </th>
                <th>
                    Price (each)
                </th>
                <th>
                    Quantity
                </th>
                <th>
                    Price(total)
                </th>
                <th></th>
            </tr>
            @foreach (var item in Model.Carts)
            {
                <tr>
                    <td>
                        @Html.ActionLink(item.Album.Title, "Details", "Store",new {id=item.AlbumId},null)
                    </td>
                    <td>
                        @String.Format("{0:F}", item.Album.Price)
                    </td>
                    <td>
                        @item.Count
                    </td>
                    <td>
                        @String.Format("{0:F}", item.Album.Price * item.Count)
                    </td>
                    <td>
                        @Html.ActionLink("Remove from cart", "RemoveFromCart", new { id = item.AlbumId })
                    </td>
                </tr>
            }
            <tr>
                <td colspan="4">Total</td>
                <td>@String.Format("{0:F}", Model.CartTotal)</td>
            </tr>
        </table>
        <p class="text-center">
            @Html.ActionLink("Checkout", "AddressAndPayment", "Checkout", null, new { @class = "btn btn-default", role = "button" })
        </p>
    }
    else
    {
        <p class="lead text-center">
            The cart is empty

        </p>
        <p class="lead text-center">Go to the @Html.ActionLink("store", "Index", "Home")</p>
    }
</div>





